@svizzle/utils/array-[string-boolean]

Methods

(static) containsOneOf(strings) → {function}

Source:
Since:
  • 0.4.0

Return a function that checks if a string contains one of the provided strings.

Example
> isWeight = containsOneOf(['(g)', '(mg)', '(mcg)'])
> weightLabels = [
	'id',
	'Energy (kcal)',
	'Protein (g)',
	'Cholesterol (mg)',
	'Selenium (mcg)'
].filter(isWeight);
['Protein (g)', 'Cholesterol (mg)', 'Selenium (mcg)']
Parameters:
Name Type Description
strings array

strings to check against

Returns:
  • String -> Boolean
Type
function